package basic;
//带参数无返回值方法
public class MethodDemo3 {
    public void printArea(int a, int b){
        int result = a * b;
        System.out.println("长方形面积为：" + result);
    }

    public static void main(String[] args) {
        MethodDemo3 methodDemo3 = new MethodDemo3();
        //  初始化两个变量
        int width = 12;
        int height = 2;
        //  传递变量
        methodDemo3.printArea(width,height);
        //也可以不提前初始化，来传递变量
        //methodDemo3.printArea(12,2);
    }
}
